home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / system / filesyst / dosfs / dosfsck_.z / dosfsck_ / dosfsck / fat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-05-08  |  1.8 KB  |  61 lines

  1. /* fat.h  -  Read/write access to the FAT */
  2.  
  3. /* Written 1993 by Werner Almesberger */
  4.  
  5.  
  6. #ifndef _FAT_H
  7. #define _FAT_H
  8.  
  9. void read_fat(DOS_FS *fs);
  10.  
  11. /* Loads the FAT of the file system described by FS. Initializes the FAT,
  12.    replaces broken FATs and rejects invalid cluster entries. */
  13.  
  14. void set_fat(DOS_FS *fs,int cluster,int new);
  15.  
  16. /* Changes the value of the CLUSTERth cluster of the FAT of FS to NEW. Special
  17.    values of NEW are -1 (EOF, 0xff8 or 0xfff8) and -2 (bad sector, 0xff7 or
  18.    0xfff7) */
  19.  
  20. int bad_cluster(DOS_FS *fs,int cluster);
  21.  
  22. /* Returns a non-zero integer if the CLUSTERth cluster is marked as bad or zero
  23.    otherwise. */
  24.  
  25. int next_cluster(DOS_FS *fs,int cluster);
  26.  
  27. /* Returns the number of the cluster following CLUSTER, or -1 if this is the
  28.    last cluster of the respective cluster chain. CLUSTER must not be a bad
  29.    cluster. */
  30.  
  31. unsigned int cluster_start(DOS_FS *fs,int cluster);
  32.  
  33. /* Returns the byte offset of CLUSTER, relative to the respective device. */
  34.  
  35. void set_owner(DOS_FS *fs,int cluster,DOS_FILE *owner);
  36.  
  37. /* Sets the owner pointer of the respective cluster to OWNER. If OWNER was NULL
  38.    before, it can be set to NULL or any non-NULL value. Otherwise, only NULL is
  39.    accepted as the new value. */
  40.  
  41. DOS_FILE *get_owner(DOS_FS *fs,int cluster);
  42.  
  43. /* Returns the owner of the repective cluster or NULL if the cluster has no
  44.    owner. */
  45.  
  46. void fix_bad(DOS_FS *fs);
  47.  
  48. /* Scans the disk for currently unused bad clusters and marks them as bad. */
  49.  
  50. void reclaim_free(DOS_FS *fs);
  51.  
  52. /* Marks all allocated, but unused clusters as free. */
  53.  
  54. void reclaim_file(DOS_FS *fs);
  55.  
  56. /* Scans the FAT for chains of allocated, but unused clusters and creates files
  57.    for them in the root directory. Also tries to fix all inconsistencies (e.g.
  58.    loops, shared clusters, etc.) in the process. */
  59.  
  60. #endif
  61.